/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  							 script_trigger_event.cpp

	$Header: /heroes4/script_trigger_event.cpp $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "script_trigger_event.h"

#include "streambuf_operators.h"
#include "adventure_map.h"
#include "adventure_map_window.h"

// --------------------------------------------------------------------------
// t_script_trigger_event members
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
bool t_script_trigger_event::read_from_map(
	std::streambuf &	stream,
	int					format_version )
{
	return read_string16( stream, m_event_name );
}

bool t_script_trigger_event::read( std::streambuf& stream, int version )
{
	return read_string16( stream, m_event_name );
}

bool t_script_trigger_event::write( std::streambuf& stream ) const
{
	if (t_abstract_script_action::write( stream ) == false) 
		return false;

	return write_string16( stream, m_event_name );
}


void t_script_trigger_event::execute(t_script_context_hero const& context) const
{
	context.map->process_triggerable_events(get_event_name(), context.map->get_map_window()->get_frame());
}

void t_script_trigger_event::execute(t_script_context_town const& context) const
{
	context.map->process_triggerable_events(get_event_name(), context.map->get_map_window()->get_frame());
}

void t_script_trigger_event::execute(t_script_context_object const& context) const
{
	context.map->process_triggerable_events(get_event_name(), context.map->get_map_window()->get_frame());
}

void t_script_trigger_event::execute(t_script_context_army const& context) const
{
	context.map->process_triggerable_events(get_event_name(), context.map->get_map_window()->get_frame());
}

void t_script_trigger_event::execute(t_script_context_global const& context) const
{
	context.map->process_triggerable_events(get_event_name(), context.map->get_map_window()->get_frame());
}

